#!/bin/sh
if [ $# -ne 1 ]
then
  echo "usage : $0 [--cflags | --incpath | --libs]" >&2
elif [ $1 = "--cflags" ]
then
  PLHEAD=`find /usr/lib/*pl* -name "SWI-cpp.h" | head -n1`
  if [ -z "$PLHEAD" ]
  then
      PLHEAD=`find /usr/local/lib/*pl* -name "SWI-cpp.h" | head -n1`
  fi
  DIRHEAD=`dirname "$PLHEAD"`
  echo "-I\"$DIRHEAD\""
elif [ $1 = "--incpath" ]
then
  PLHEAD=`find /usr/lib/*pl* -name "SWI-cpp.h" | head -n1`
  if [ -z "$PLHEAD" ]
  then
     PLHEAD=`find /usr/local/lib/*pl* -name "SWI-cpp.h" | head -n1`
  fi
  DIRHEAD=`dirname "$PLHEAD"`
  echo "\"$DIRHEAD\""

elif [ $1 = "--libs" ]
then
  PLLIB=`find /usr/lib/*pl* -name libpl.so | head -n1`
  if [ -z "$PLLIB" ]
  then
      PLLIB=`find /usr/local/lib/*pl* -name libpl.so | head -n1`
  fi

  DIRLIB=`dirname "$PLLIB"`
  echo "-L\"$DIRLIB\" -lpl"
else
  echo "usage : $0 [--cflags | --incpath | --libs]" >&2
fi



